from flask import Flask, request, jsonify
from douyin_center_spider_授权测试 import *
app = Flask(__name__)



@app.route('/process', methods=['GET','POST'])
def process_data():
    # try:
    if request.method == 'POST':
        data = request.get_json()
        user_id = data["user_id"]

        res = DY_XPIDER(str(user_id))
        result_data = res.dy_creator_center_spider()
        print(user_id)
        print(result_data)
        print(result_data)
        return result_data

    else:
        user_id = request.args["user_id"]
        res = DY_XPIDER(str(user_id))
        result_data = res.dy_creator_center_spider()
        return result_data
    # except:
    #     return {"msg":"未传参数","code":"500"}


if __name__ == '__main__':

    app.run(host='0.0.0.0',port=5009,threaded=True)
